home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.0 KB | 104 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWExcept.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFound.hpp"
-
- #ifndef FWEXCEPT_H
- #include "FWExcept.h"
- #endif
-
- #ifndef FWPRIMEM_H
- #include "FWPriMem.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- #include <stddef.h>
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment BEL
- #endif
-
- //========================================================================================
- // CLASS _FW_XException
- //========================================================================================
-
- FW_DEFINE_EXCEPTION_ROOT(_FW_XException)
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::operator new
- //----------------------------------------------------------------------------------------
-
- void* _FW_XException::operator new(size_t /* size */)
- {
- FW_PRIV_ASSERT(FALSE); // exceptions should be on the stack
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::operator delete
- //----------------------------------------------------------------------------------------
-
- void _FW_XException::operator delete(void* /* memory */)
- {
- FW_PRIV_ASSERT(FALSE); // exceptions should be on the stack
- }
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::_FW_XException
- //----------------------------------------------------------------------------------------
- _FW_XException::_FW_XException()
- {
- #ifdef FW_DEBUG
- fIsValid = 1;
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::~_FW_XException
- //----------------------------------------------------------------------------------------
- _FW_XException::~_FW_XException()
- {
- #ifdef FW_DEBUG
- FW_PRIV_ASSERT(fIsValid==1);
- fIsValid = 0;
- #endif
- }
-
- #ifndef FW_NATIVE_EXCEPTIONS
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::PrivIsKindOf()
- //----------------------------------------------------------------------------------------
-
- int _FW_XException::PrivIsKindOf(FW_ClassInfoPtr aClass)
- {
- FW_PRIV_ASSERT(fIsValid==1);
- return PrivVirtualGetClassInfo()->IsKindOf(aClass);
- }
-
- #endif // FW_NATIVE_EXCEPTIONS
-
- //----------------------------------------------------------------------------------------
- // _FW_XException::Copy(void *p)
- //----------------------------------------------------------------------------------------
- void _FW_XException::Copy(void *p, size_t maxObjectSize) const
- {
- FW_PRIV_ASSERT(fIsValid == 1);
- size_t objectSize = GetSize();
- FW_PRIV_ASSERT(objectSize <= maxObjectSize);
- FW_PrimitiveCopyMemory(this, p, objectSize);
- }
-